{include file="public/header"/}
<link rel="stylesheet" href="/public/static/admin/easyui/layui-v2.6.8/css/layui.css">
<link rel="stylesheet" type="text/css" href="/public/static/admin/easyui/jeasyui/themes/icon.css">

<style>
    #matchCon, #matchDesc, #matchDescMul { width: 150px; }
    .fl{display:flex;flex-direction:column;}
    .sourceOrderLink{text-decoration:underline;cursor:pointer}
    .ul-inline-mul{display:flex;flex-direction:column;width:100%;}
    .top-mul{display:flex;flex-direction:row;justify-content:space-between;font-size: 12px;}
    .top-mul input{margin:0 5px;}
    #billNoInput { width: 550px; height:18px;}
    .bottom-mul{display:flex;flex-direction:row;align-items:center;margin-top:10px;}
    .bottom-mul label{display:block;height:18px;margin-right:15px;}
</style>

<div class="container" style="margin:10px 20px;">
    <div class="mod-search m0 cf">
        <div class="fl">
            <!-- 批量搜索源单号 -->
            <div class="ul-inline ul-inline-mul" id='multiSel'>
                <div class="top-mul">
                    <div>
                        <label>日期:</label>
                        <input type="date" id="beginDateMul" value="2021-08-17" class="ui-input " style="font-size: 12px;width: 130px;">
                        <i>-</i>
                        <input type="date" id="endDateMul" value="2021-08-23" class="ui-input "  style="font-size: 12px;width: 130px;">
                        <label>备注:</label>
                        <input type="text" id="matchDescMul" class="ui-input ui-input-ph" value="请输入备注"  style="font-size: 12px;">
                    </div>
                    <div><a class="ui-btn" id="searchMul" onclick="aaa()">查询</a>
                        <!--<a class="ui-btn ui-btn-refresh" id="refresh" title="刷新"><b></b></a>-->
                    </div>
                </div>
                <div class="bottom-mul">
                    <label>源单编号:</label>
                    <textarea type="text" id="billNoInput" class="ui-input ui-input-ph"  value="" placeholder="将word excel txt文档中的单号复制粘贴到此处，支持以【空格、逗号、分号(英文格式)】分隔" style="font-size: 12px;"></textarea>
                </div>
            </div>
        </div>
    </div>
    <div class="grid-wrap">
        <table id="grid">
        </table>
        <div id="page"></div>
    </div>
</div>

<script src="/public/static/admin/easyui/layui-v2.6.8/layui.js"></script>
<script type="text/javascript" src="/public/static/admin/easyui/jeasyui/jquery.easyui.min.js"></script>

<script>
    $(document).ready(function () {

        $("#grid").jqGrid({
	    	url:'/admin/basic/choose_source_pay_list.html?ajax=100&user_id={$user_id}',
	        datatype: "json",//数据来源，本地数据（local，json,jsonp,xml等）
	        height:'290px',//高度，表格高度。可为数值、百分比或'auto'
	        //width: Public.setGrid().w,
	        //height: Public.setGrid().h,
	        colNames: [ "源单编号", "业务类别", "单据日期", "单据金额","已核销金额","未核销金额","备注",'ID'],
	        colModel:[
	            {name:'sn', width:120,lable:'源单编号'},
	            {name:'o_type_name', width:80,lable:'业务类别'},
	            {name:'dj_time', width:70,lable:'单据日期'},
	            {name:'dj_jine', width:100,lable:'单据金额'},
	            {name:'already_jine', width:100,lable:'已核销金额'},
	            {name:'not_jine', width:100,lable:'未核销金额'},
	            {name:'mark', width:150,lable:'备注'},
	            {name:'id', hidden:true},
	       	],
	       	//cellEdit:true,
	       	//cellurl : '/',
	       	// cellsubmit:false,
	        rowNum:10,
	       	rowList:[10,20,30],
	        sortname: 'id',
	     	sortorder: "desc",
	     	pagerpos:"left",//分页位置
	     	
	     	pgbuttons:true,//翻页按钮
	     	pagination:true,
	     	altRows: !0,
	        gridview: !0,
	        shrinkToFit: !1,
	        cellLayout: 8,
	        autowidth: !0,
	        pager: "#page",
	        viewrecords: !0,
            checkOnSelect: true,
            multiselect:true,//自带多选
            //multiboxonly:true,//变成单选
	        cmTemplate: {
	            sortable: !1,
	            title: !1
	        },
		    loadError: function(t, e, i) {
			    parent.Public.tips({
			        type: 1,
			        content: "操作失败了哦，请检查您的网络链接！"
			    })
			},
			gridComplete: function() {
                var rowIds = $("#grid").jqGrid('getDataIDs');
                for(var k=0; k<rowIds.length; k++) {
                   var curRowData = $("#grid").jqGrid('getRowData', rowIds[k]);
                   var curChk = $("#"+rowIds[k]+"").find(":checkbox");
                   curChk.attr('name', 'checkboxname');   //给每一个checkbox赋名字
                   curChk.attr('value', curRowData['id']);   //给checkbox赋值
                   //curChk.attr('title', curRowData['id'] );   //给checkbox赋予额外的属性值
                   //curChk.attr('checked', 'true');   //设置所有checkbox被选中
                }
            },
   		});

    });



</script>
<script type="text/javascript">
	function aaa(){

		//判断是否至少有一个选中
		if($('.cbox').is(':checked')) {
			console.log("111");
		}else{
			console.log("000");
		}
		var ids = [];
		$("#grid input:checkbox[name='checkboxname']:checked").each(function(i){
		   ids.push($(this).val());
		   //checkedTitles.push($(this).attr("title"));
		});
		console.log(ids);
	}
	

</script>
{include file="public/footer"/}